<% layout('/layouts/default.html', {title: '数据管理', libs:
['validate','fileupload','ueditor','dataGrid']}){ %>
<div class="main-content">
	<div class="box box-main">
		<div class="box-header with-border">
			<div class="box-title">
				<i class="fa fa-list-alt"></i> ${text(ztGoods.isNewRecord ? '新增商品' :
				'编辑商品')}
			</div>
			<div class="box-tools pull-right">
				<button type="button" class="btn btn-box-tool"
					data-widget="collapse">
					<i class="fa fa-minus"></i>
				</button>
			</div>
		</div>
		<#form:form id="inputForm" model="${ztGoods}"
		action="${ctx}/ztGoods/save" method="post" class="form-horizontal">
		<div class="box-body">
			<div class="form-unit">${text('商品信息')}</div>
			<#form:hidden path="id"/>
			<#form:hidden path="ztGoodsid"/>
			<#form:hidden path="code"/>
			<#form:hidden path="spotid"/>
			<div class="row">
				<div class="col-xs-6">
					<div class="form-group">
						<label class="control-label col-sm-4" title=""> <span
							class="required">*</span> ${text('商品栏目类型')}：<i
							class="fa icon-question hide"></i></label>
						<div class="col-sm-8">
						
						<#form:select path="goodstemp"
							multiple="true" 
							dictType="zt_goodstemp_type" blankOption="true" class="form-control required"
							onchange="findtemplate(goodstemp)"/>

							</div>
					</div>
				</div>
				
				<div class="col-xs-6">
					<div class="form-group">
						<label class="control-label col-sm-4" title=""> <span
							class="required">*</span> ${text('商品渠道类型')}：<i
							class="fa icon-question hide"></i></label>
						<div class="col-sm-8">
						
						<#form:select path="spotid"
							
							dictType="zt_spotid_type" blankOption="true" class="form-control required"
							disabled="disabled"/>

							</div>
					</div>
				</div>
				
				
			</div>
			
			<div class="row">
				<div class="col-xs-6">
					<div class="form-group">
						<label class="control-label col-sm-4" title=""> <span
							class="required">*</span> ${text('商品名')}：<i
							class="fa icon-question hide"></i></label>
						<div class="col-sm-8"><#form:input path="title"
							maxlength="200" class="form-control required "/></div>
					</div>
				</div>
				<div class="col-xs-6">
					<div class="form-group">
						<label class="control-label col-sm-4" title=""> <span
							class="required ">*</span> ${text('关键词(‘，’分隔)')}：<i
							class="fa icon-question hide"></i></label>
						<div class="col-sm-8"><#form:input path="keys"
							maxlength="230" class="form-control required"/></div>

					</div>
				</div>
			</div>

			<div class="row">
				<div class="col-xs-6">
					<div class="form-group">
						<label class="control-label col-sm-4" title=""> <span
							class="required hide">*</span> ${text('商品编号')}：<i
							class="fa icon-question hide"></i></label>
						<div class="col-sm-8"><#form:input path="code" 
							maxlength="30" class="form-control"/></div>
					</div>
				</div>
				<div class="col-xs-6">
					<div class="form-group">
						<label class="control-label col-sm-4" title=""> <span
							class="required hide">*</span><i
							class="fa icon-question hide"></i></label>
						<div class="col-sm-8">
						
						<% if (ztGoods!=null && ztGoods.id !=null){ %>
						<input id="retrieval" onclick="openWin('${ctx}/ztColor/list?ztGoods.id=${ztGoods.id}', 900, 600)"
				class="btn btn-primary" type="button" style="background:#00B2EE" value="商品关联属性的商品集" />
						<% } %>
						<% if (ztGoods==null || ztGoods.id ==null){ %>
						<input id="retrieval" onclick="openWin('${ctx}/ztColor/list?ztGoods.id=${ztGoods.ztGoodsid}', 900, 600)"
				class="btn btn-primary" type="button" style="background:#00B2EE" value="商品关联属性的商品集" />
						<% } %>
						
						</div> 
					</div>	
				</div>
			</div>

			<div class="row">
				<div class="col-xs-6">
					<div class="form-group">
						<label class="control-label col-sm-4" title=""> <span
							class="required"></span> ${text('品牌类型')}：<i
							class="fa icon-question hide"></i></label>
						<div class="col-sm-8"><#form:select path="brandid" id="brandid"
							items="${brandList}" itemLabel="name" itemValue="id"
							blankOption="true" class="form-control "/></div>
					</div>
				</div>
					
				<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4">${text('商品类型')}：</label>
							<div class="col-sm-8">
							
								<#form:treeselect id="parent" title="${text('商品类型')}"
									path="type" labelPath="typeName" 
									checkbox="true" 
									url="${ctx}/goodsType/treeData"
									class="" allowClear="true" canSelectRoot="true" canSelectParent="true"/>
							
							</div>
						</div>
				</div>
				
			</div>

			<div class="row">
				<div class="col-xs-12">
					<div class="form-group">
						<label class="control-label col-sm-2" title=""> <span
							class="required hide">*</span> ${text('商品描述')}：<i
							class="fa icon-question hide"></i></label>
						<div class="col-sm-10"><#form:textarea path="remarks"
							rows="4" maxlength="200" class="form-control"/></div>
					</div>
				</div>
			</div>
			
			
			

			<div class="row">
				<div class="col-xs-6">
					<div class="form-group">
						<label class="control-label col-sm-4" title=""> <span
							class="required hide">*</span> ${text('权重')}：<i
							class="fa icon-question hide"></i></label>
						<div class="col-sm-8"><#form:input path="weig"
							onkeyup="this.value=this.value.replace(/[^0-9-]+/,'');"
							maxlength="20" class="form-control required" />
							<span
							class="required hide">值越大越靠前</span>
							</div>
					</div>
				</div>
				<div class="col-xs-6">
					<div class="form-group">
						<label class="control-label col-sm-4" title=""> <span
							class="required ">*</span> ${text('上架状态')}：<i
							class="fa icon-question hide"></i></label>
						<div class="col-sm-8"><#form:radio path="sjStatus"
							dictType="zt_sj_type" class="form-control" /></div>
					</div>
				</div>
			</div>


			

			<div class="row">
				<div class="col-xs-12">
					<div class="form-group">
						<label class="control-label col-sm-2" title=""> <span
							class="required hide">*</span> 商品详细信息：<i
							class="fa icon-question hide"></i></label>
						<div class="col-sm-10"><#form:ueditor path="content"
							maxlength="20000" height="400" class="" simpleToolbars="true"
							readonly="false" outline="false"/></div>
					</div>
				</div>
			</div>
			
			<div class="row">
				<div class="col-xs-12">
					<div class="form-group">
						<label class="control-label col-sm-2">${text('商品封面图片上传：<br/>小图尺寸110*100<br/>轮播图尺寸375*225')}</label>
						<div class="col-sm-10">
						
						<#form:fileupload id="upload10" returnPath="true"
	filePathInputId="img" bizKey="${ztGoods.id}" bizType="user_upload10"
	uploadType="image" readonly="false" maxUploadNum="1" isMini="false"/>
<#form:input name="img" class="form-control" id="inputimg"/>

							</div>
					</div>
				</div>
			</div>
			<div class="row">
				<div class="col-xs-12">
					<div class="form-group">
						<label class="control-label col-sm-2">${text('商品封面大图图片上传：<br/>小图尺寸110*100<br/>轮播图尺寸375*225')}</label>
						<div class="col-sm-10">
						
						<#form:fileupload id="upload2" returnPath="true"
	filePathInputId="qcode" bizKey="${ztGoods.id}" bizType="user_upload2"
	uploadType="image" readonly="false" maxUploadNum="1" isMini="false"/>
<#form:input name="qcode" class="form-control" id="qcode"/>

							</div>
					</div>
				</div>
			</div>

			<div class="row">
				<div class="col-xs-12">
					<div class="form-group">
						<label class="control-label col-sm-2">${text('商品内容图片上传：<br/>尺寸375*325')}</label>
						<div class="col-sm-10">
						
						<#form:fileupload id="upload1" returnPath="true"
	filePathInputId="contentimgs" bizKey="${ztGoods.id}" bizType="user_upload1"
	uploadType="image" readonly="false" maxUploadNum="8" isMini="false"/>
<#form:input name="contentimgs" class="form-control" id="contentimgs"/>
							
							</div>
					</div>
				</div>
			</div>
			
			
			<div class="row">
				<div class="col-xs-12">
					<div class="form-group">
						<label class="control-label col-sm-2">${text('商品短视频上传')}：</label>
						<div class="col-sm-10">
					
							<#form:fileupload id="upload3" returnPath="true"
	filePathInputId="file"  bizKey="${ztGoods.id}" bizType="user_upload3"
	uploadType="media" readonly="false" maxUploadNum="1" isMini="false"/>
<#form:input name="file" class="form-control"/>
							</div>
					</div>
				</div>
			</div>
			
			
			<div class="form-unit">${text('商品价格')}</div>
			<div class="row">
				<div class="col-xs-6">
					<div class="form-group">
						<label class="control-label col-sm-5" title=""> <span
							class="required">*</span> ${text('协议价')}：<i
							class="fa icon-question hide"></i></label>
						<div class="col-sm-7"><#form:input path="supplyPrice" id="supplyPrice"
							onkeyup="this.value=this.value.replace(/[^0-9-.-]+/,'');"
							maxlength="10" class="form-control required"/></div>
					</div>
				</div>
				
				<div class="col-xs-6">
					<div class="form-group">
						<label class="control-label col-sm-5" title=""> <span
							class="required">*</span> ${text('划线价(折扣参照价)')}：<i
							class="fa icon-question hide"></i></label>
						<div class="col-sm-7"><#form:input path="origPrice" id="origPrice"
							onkeyup="this.value=this.value.replace(/[^0-9-.-]+/,'');"
							maxlength="10" class="form-control"/></div>
					</div>
				</div>
				</div>
				<div class="row">
				
				<div class="col-xs-6">
					<div class="form-group">
						<label class="control-label col-sm-5" title=""> <span
							class="required">*</span> ${text('会员价')}：<i
							class="fa icon-question hide"></i></label>
						<div class="col-sm-7">
						<#form:input path="discountPrice" id="discountPrice"
							onkeyup="this.value=this.value.replace(/[^0-9-.-]+/,'');"
							maxlength="10" class="form-control required"/>
							
						</div>
					</div>
				</div>
				<div class="col-xs-6">
				<div class="form-group">
						<label class="control-label col-sm-5" title=""> <span
							class="required">*</span> ${text('会员一级佣金')}：<i
							class="fa icon-question hide"></i></label>
						<div class="col-sm-7">
						<#form:input path="discountOnePrice" id="discountOnePrice"
							onkeyup="this.value=this.value.replace(/[^0-9-.-]+/,'');"
							maxlength="10" class="form-control required"/>
							
						</div>
					</div>
				</div>
			</div>
			
			<div class="form-unit" style="margin-left: 50px;">普通用户</div>
			<div class="row">
				<div class="col-xs-4">
					<div class="form-group">
						<label class="control-label col-sm-6" title=""> <span
							class="required">*</span> ${text('商品价：')}<i
							class="fa icon-question hide"></i></label>
						<div class="col-sm-6"><#form:input path="commonPrice" id="commonPrice"
							onkeyup="this.value=this.value.replace(/[^0-9-.-]+/,'');"
							maxlength="10" class="form-control required"/></div>
					</div>
				</div>
				<div class="col-xs-4">
					<div class="form-group">
						<label class="control-label col-sm-6" title=""> <span
							class="required">*</span> ${text('普通用户一级佣金')}：<i
							class="fa icon-question hide"></i></label>
						<div class="col-sm-6"><#form:input path="commonOnePrice"
							onkeyup="this.value=this.value.replace(/[^0-9-.-]+/,'');"
							maxlength="10" class="form-control required"/></div>
					</div>
				</div>
			</div>
			
			<div class="form-unit" style="margin-left: 50px;">铜级掌柜用户</div>
			<div class="row">
				<div class="col-xs-4">
					<div class="form-group">
						<label class="control-label col-sm-4" title=""> <span
							class="required">*</span> ${text('商品价')}：<i
							class="fa icon-question hide"></i></label>
						<div class="col-sm-8"><#form:input path="copperPrice"
							onkeyup="this.value=this.value.replace(/[^0-9-.-]+/,'');"
							maxlength="10" class="form-control required"/></div>
					</div>
				</div>
				<div class="col-xs-4">
					<div class="form-group">
						<label class="control-label col-sm-4" title=""> <span
							class="required">*</span> ${text('一级佣金(普)')}：<i
							class="fa icon-question hide"></i></label>
						<div class="col-sm-8"><#form:input path="copperOnePrice"
							onkeyup="this.value=this.value.replace(/[^0-9-.-]+/,'');"
							maxlength="10" class="form-control required"/></div>
					</div>
				</div>
				<div class="col-xs-4">
					<div class="form-group">
						<label class="control-label col-sm-4" title=""> <span
							class="required">*</span> ${text('二级佣金(普)')}：<i
							class="fa icon-question hide"></i></label>
						<div class="col-sm-8"><#form:input path="copperTwoPrice"
							onkeyup="this.value=this.value.replace(/[^0-9-.-]+/,'');"
							maxlength="10" class="form-control required"/></div>
					</div>
				</div>
			</div>
			<div class="row">
				<div class="col-xs-4">
				</div>
				<div class="col-xs-4">
					<div class="form-group">
						<label class="control-label col-sm-4" title=""> <span
							class="required">*</span> ${text('一级佣金(铜)')}：<i
							class="fa icon-question hide"></i></label>
						<div class="col-sm-8"><#form:input path="tcopperOnePrice"
							onkeyup="this.value=this.value.replace(/[^0-9-.-]+/,'');"
							maxlength="10" class="form-control required"/></div>
					</div>
				</div>
				<div class="col-xs-4">
					<div class="form-group">
						<label class="control-label col-sm-4" title=""> <span
							class="required">*</span> ${text('二级佣金(铜)')}：<i
							class="fa icon-question hide"></i></label>
						<div class="col-sm-8"><#form:input path="tcopperTwoPrice"
							onkeyup="this.value=this.value.replace(/[^0-9-.-]+/,'');"
							maxlength="10" class="form-control required"/></div>
					</div>
				</div>
			</div>
				<div class="row">
				<div class="col-xs-4">
				</div>
				<div class="col-xs-4">
					<div class="form-group">
						<label class="control-label col-sm-4" title=""> <span
							class="required">*</span> ${text('一级佣金(银)')}：<i
							class="fa icon-question hide"></i></label>
						<div class="col-sm-8"><#form:input path="ycopperOnePrice"
							onkeyup="this.value=this.value.replace(/[^0-9-.-]+/,'');"
							maxlength="10" class="form-control required"/></div>
					</div>
				</div>
				<div class="col-xs-4">
					<div class="form-group">
						<label class="control-label col-sm-4" title=""> <span
							class="required">*</span> ${text('二级佣金(银)')}：<i
							class="fa icon-question hide"></i></label>
						<div class="col-sm-8"><#form:input path="ycopperTwoPrice"
							onkeyup="this.value=this.value.replace(/[^0-9-.-]+/,'');"
							maxlength="10" class="form-control required"/></div>
					</div>
				</div>
			</div>
				<div class="row">
				<div class="col-xs-4">
				</div>
				<div class="col-xs-4">
					<div class="form-group">
						<label class="control-label col-sm-4" title=""> <span
							class="required">*</span> ${text('一级佣金(金)')}：<i
							class="fa icon-question hide"></i></label>
						<div class="col-sm-8"><#form:input path="jcopperOnePrice"
							onkeyup="this.value=this.value.replace(/[^0-9-.-]+/,'');"
							maxlength="10" class="form-control required"/></div>
					</div>
				</div>
				<div class="col-xs-4">
					<div class="form-group">
						<label class="control-label col-sm-4" title=""> <span
							class="required">*</span> ${text('二级佣金(金)')}：<i
							class="fa icon-question hide"></i></label>
						<div class="col-sm-8"><#form:input path="jcopperTwoPrice"
							onkeyup="this.value=this.value.replace(/[^0-9-.-]+/,'');"
							maxlength="10" class="form-control required"/></div>
					</div>
				</div>
			</div>
			<div class="form-unit" style="margin-left: 50px;">特惠专区</div>
			<div class="row">
				<div class="col-xs-5">
					<div class="form-group">
						<label class="control-label col-sm-4" title=""> <span
								class="required"></span> ${text('特惠方式：')}<i
								class="fa icon-question hide"></i></label>
						<div class="col-sm-8">
							<#form:select path="newTalentType" multiple="true"
							dictType="new_talent_type"  blankOption="true" class="form-control" />
						</div>
						<label class="control-label col-sm-6" id="titleNewTalentType" style="color:red;font-size: 13px"></label>
					</div>
				</div>
			</div>
		</div>
		<!--<div class="form-unit" style="margin-left: 50px;">新人特惠</div>
		<div class="row">
			<div class="col-xs-4">
				<div class="form-group">
					<label class="control-label col-sm-6" title=""> <span
							class="required"></span> ${text('限定购买数量')}：<i
							class="fa icon-question hide"></i></label>
					<div class="col-sm-6">
						<#form:input path="buyQuantity"
						onkeyup="this.value=this.value.replace(/[^0-9]+/,'');"
						maxlength="2" class="form-control"/>
					</div>
					<label class="control-label col-sm-6" id="titleBuyQuantity" style="color:red;font-size: 13px"></label>
				</div>
			</div>

			<div class="col-xs-4">
				<div class="form-group">
					<label class="control-label col-sm-6" title=""> <span
							class="required"></span> ${text('新人专属价：')}<i
							class="fa icon-question hide"></i></label>
					<div class="col-sm-6"><#form:input path="newPrice"
						onkeyup="this.value=this.value.replace(/[^0-9-.-]+/,'');"
						maxlength="10" class="form-control"/>
					</div>
					<label class="control-label col-sm-6" id="titleNewPrice" style="color:red;font-size: 13px"></label>
				</div>
			</div>
		</div>-->
	<!--		<div class="form-unit" style="margin-left: 50px;">银级掌柜用户</div>
			<div class="row">
				<div class="col-xs-4">
					<div class="form-group">
						<label class="control-label col-sm-4" title=""> <span
							class="required">*</span> ${text('商品价')}：<i
							class="fa icon-question hide"></i></label>
						<div class="col-sm-8"><#form:input path="silverPrice"
							onkeyup="this.value=this.value.replace(/[^0-9-.-]+/,'');"
							maxlength="10" class="form-control required"/></div>
					</div>
				</div>
				<div class="col-xs-4">
					<div class="form-group">
						<label class="control-label col-sm-4" title=""> <span
							class="required">*</span> ${text('一级佣金(普)')}：<i
							class="fa icon-question hide"></i></label>
						<div class="col-sm-8"><#form:input path="silverOnePrice"
							onkeyup="this.value=this.value.replace(/[^0-9-.-]+/,'');"
							maxlength="10" class="form-control required"/></div>
					</div>
				</div>
				<div class="col-xs-4">
					<div class="form-group">
						<label class="control-label col-sm-4" title=""> <span
							class="required">*</span> ${text('二级佣金(普)')}：<i
							class="fa icon-question hide"></i></label>
						<div class="col-sm-8"><#form:input path="silverTwoPrice"
							onkeyup="this.value=this.value.replace(/[^0-9-.-]+/,'');"
							maxlength="10" class="form-control required"/></div>
					</div>
				</div>
			</div>
			<div class="row">
				<div class="col-xs-4">
				</div>
				<div class="col-xs-4">
					<div class="form-group">
						<label class="control-label col-sm-4" title=""> <span
							class="required">*</span> ${text('一级佣金(铜)')}：<i
							class="fa icon-question hide"></i></label>
						<div class="col-sm-8"><#form:input path="tsilverOnePrice"
							onkeyup="this.value=this.value.replace(/[^0-9-.-]+/,'');"
							maxlength="10" class="form-control required"/></div>
					</div>
				</div>
				<div class="col-xs-4">
					<div class="form-group">
						<label class="control-label col-sm-4" title=""> <span
							class="required">*</span> ${text('二级佣金(铜)')}：<i
							class="fa icon-question hide"></i></label>
						<div class="col-sm-8"><#form:input path="tsilverTwoPrice"
							onkeyup="this.value=this.value.replace(/[^0-9-.-]+/,'');"
							maxlength="10" class="form-control required"/></div>
					</div>
				</div>
			</div>
			<div class="row">
				<div class="col-xs-4">
				</div>
				<div class="col-xs-4">
					<div class="form-group">
						<label class="control-label col-sm-4" title=""> <span
							class="required">*</span> ${text('一级佣金(银)')}：<i
							class="fa icon-question hide"></i></label>
						<div class="col-sm-8"><#form:input path="ysilverOnePrice"
							onkeyup="this.value=this.value.replace(/[^0-9-.-]+/,'');"
							maxlength="10" class="form-control required"/></div>
					</div>
				</div>
				<div class="col-xs-4">
					<div class="form-group">
						<label class="control-label col-sm-4" title=""> <span
							class="required">*</span> ${text('二级佣金(银)')}：<i
							class="fa icon-question hide"></i></label>
						<div class="col-sm-8"><#form:input path="ysilverTwoPrice"
							onkeyup="this.value=this.value.replace(/[^0-9-.-]+/,'');"
							maxlength="10" class="form-control required"/></div>
					</div>
				</div>
			</div>
			<div class="row">
				<div class="col-xs-4">
				</div>
				<div class="col-xs-4">
					<div class="form-group">
						<label class="control-label col-sm-4" title=""> <span
							class="required">*</span> ${text('一级佣金(金)')}：<i
							class="fa icon-question hide"></i></label>
						<div class="col-sm-8"><#form:input path="jsilverOnePrice"
							onkeyup="this.value=this.value.replace(/[^0-9-.-]+/,'');"
							maxlength="10" class="form-control required"/></div>
					</div>
				</div>
				<div class="col-xs-4">
					<div class="form-group">
						<label class="control-label col-sm-4" title=""> <span
							class="required">*</span> ${text('二级佣金(金)')}：<i
							class="fa icon-question hide"></i></label>
						<div class="col-sm-8"><#form:input path="jsilverTwoPrice"
							onkeyup="this.value=this.value.replace(/[^0-9-.-]+/,'');"
							maxlength="10" class="form-control required"/></div>
					</div>
				</div>
			</div>
			
			<div class="form-unit" style="margin-left: 50px;">黄金掌柜用户</div>
			<div class="row">
				<div class="col-xs-4">
					<div class="form-group">
						<label class="control-label col-sm-4" title=""> <span
							class="required">*</span> ${text('商品价')}：<i
							class="fa icon-question hide"></i></label>
						<div class="col-sm-8"><#form:input path="goldPrice"
							onkeyup="this.value=this.value.replace(/[^0-9-.-]+/,'');"
							maxlength="10" class="form-control required"/></div>
					</div>
				</div>
				<div class="col-xs-4">
					<div class="form-group">
						<label class="control-label col-sm-4" title=""> <span
							class="required">*</span> ${text('一级佣金(普)')}：<i
							class="fa icon-question hide"></i></label>
						<div class="col-sm-8"><#form:input path="goldOnePrice"
							onkeyup="this.value=this.value.replace(/[^0-9-.-]+/,'');"
							maxlength="10" class="form-control required"/></div>
					</div>
				</div>
				<div class="col-xs-4">
					<div class="form-group">
						<label class="control-label col-sm-4" title=""> <span
							class="required">*</span> ${text('二级佣金(普)')}：<i
							class="fa icon-question hide"></i></label>
						<div class="col-sm-8"><#form:input path="goldTwoPrice"
							onkeyup="this.value=this.value.replace(/[^0-9-.-]+/,'');"
							maxlength="10" class="form-control required"/></div>
					</div>
				</div>
			</div>
			
			<div class="row">
				<div class="col-xs-4">
				</div>
				<div class="col-xs-4">
					<div class="form-group">
						<label class="control-label col-sm-4" title=""> <span
							class="required">*</span> ${text('一级佣金(铜)')}：<i
							class="fa icon-question hide"></i></label>
						<div class="col-sm-8"><#form:input path="tgoldOnePrice"
							onkeyup="this.value=this.value.replace(/[^0-9-.-]+/,'');"
							maxlength="10" class="form-control required"/></div>
					</div>
				</div>
				<div class="col-xs-4">
					<div class="form-group">
						<label class="control-label col-sm-4" title=""> <span
							class="required">*</span> ${text('二级佣金(铜)')}：<i
							class="fa icon-question hide"></i></label>
						<div class="col-sm-8"><#form:input path="tgoldTwoPrice"
							onkeyup="this.value=this.value.replace(/[^0-9-.-]+/,'');"
							maxlength="10" class="form-control required"/></div>
					</div>
				</div>
			</div>
			
			<div class="row">
				<div class="col-xs-4">
				</div>
				<div class="col-xs-4">
					<div class="form-group">
						<label class="control-label col-sm-4" title=""> <span
							class="required">*</span> ${text('一级佣金(银)')}：<i
							class="fa icon-question hide"></i></label>
						<div class="col-sm-8"><#form:input path="ygoldOnePrice"
							onkeyup="this.value=this.value.replace(/[^0-9-.-]+/,'');"
							maxlength="10" class="form-control required"/></div>
					</div>
				</div>
				<div class="col-xs-4">
					<div class="form-group">
						<label class="control-label col-sm-4" title=""> <span
							class="required">*</span> ${text('二级佣金(银)')}：<i
							class="fa icon-question hide"></i></label>
						<div class="col-sm-8"><#form:input path="ygoldTwoPrice"
							onkeyup="this.value=this.value.replace(/[^0-9-.-]+/,'');"
							maxlength="10" class="form-control required"/></div>
					</div>
				</div>
			</div>
			<div class="row">
				<div class="col-xs-4">
				</div>
				<div class="col-xs-4">
					<div class="form-group">
						<label class="control-label col-sm-4" title=""> <span
							class="required">*</span> ${text('一级佣金(金)')}：<i
							class="fa icon-question hide"></i></label>
						<div class="col-sm-8"><#form:input path="jgoldOnePrice"
							onkeyup="this.value=this.value.replace(/[^0-9-.-]+/,'');"
							maxlength="10" class="form-control required"/></div>
					</div>
				</div>
				<div class="col-xs-4">
					<div class="form-group">
						<label class="control-label col-sm-4" title=""> <span
							class="required">*</span> ${text('二级佣金(金)')}：<i
							class="fa icon-question hide"></i></label>
						<div class="col-sm-8"><#form:input path="jgoldTwoPrice"
							onkeyup="this.value=this.value.replace(/[^0-9-.-]+/,'');"
							maxlength="10" class="form-control required"/></div>
					</div>
				</div>
			</div>
			
		-->
		</div>
		<div class="box-footer">
			<div class="row">
				<div class="col-sm-offset-2 col-sm-10">
					<% if (hasPermi('ztAutoGoods:ztAutoGoodsData:edit')){ %>
					
					<button type="button" class="btn btn-sm btn-primary" id="onclickPrice">
						<i class="fa fa-check"></i> ${text('按规则定价')}
					</button>
					
					<button type="submit" class="btn btn-sm btn-primary" id="btnSubmit">
						<i class="fa fa-check"></i> ${text('保 存')}
					</button>
					&nbsp; <% } %>
					<button type="button" class="btn btn-sm btn-default" id="btnCancel"
						onclick="js.closeCurrentTabPage()">
						<i class="fa fa-reply-all"></i> ${text('关 闭')}
					</button>
				</div>
			</div>
		</div>
		</#form:form>
	</div>
</div>
<% } %>
<script>

function openWin(u, w, h) { 
    var l = (screen.width - w) / 2; 
    var t = (screen.height - h) / 2; 
    var s = 'width=' + w + ', height=' + h + ', top=' + t + ', left=' + l; 
    s += ', toolbar=no, scrollbars=no, menubar=no, location=no, resizable=no'; 
    open(u, 'oWin', s); 
} 

	
window.onload=function (){

	$("#upload3dndArea p").text("或将视频拖到这里,最多可选 1 个");
	
	var img="${ztGoods.img}";
	var qcode="${ztGoods.qcode}";
	var contentimgs="${ztGoods.contentimgs}";
	
	$("#inputimg").val(img);
	$("#qcode").val(qcode);
	
	$("#contentimgs").val(contentimgs);
	var goodstemp="${ztGoods.goodstemp}"
	if(goodstemp.indexOf("6")>0){
		$("#titleBuyQuantity").html("*提示:记得填写限定购买数量")
		$("#titleNewTalentType").html("*提示:记得选择新人特惠")
		$("#titleNewPrice").html("*提示:记得填写新人专属价")
	};
}

$(function() {


	
	$("#brandid").change(function() {

		var brandid = $("#brandid").val();
		if(brandid!=null && brandid!=''){
			getGoodsType(brandid);
		}

	});
	//原价
	 $("#onclickPrice").on('click',function(){
	
		var origPrice = $("#origPrice").val();//划线价
		var supplyPrice = $("#supplyPrice").val();//协议价
		if(origPrice == null || origPrice == undefined || origPrice ==''
		||supplyPrice == null || supplyPrice == undefined || supplyPrice ==''){	
			return;
		}
		
		 var reg = /^(.*\..{2}).*$/;
		    var number2 = (supplyPrice*100)/origPrice;
		    number2 = String(number2).replace(reg ,"$1");
		    number2 = Number(number2);
		    
		 var switDiscount = ${ztSk.switDiscount};
		 if(number2>switDiscount){//
			 var minGross = ${ztMle.minGross};
			 var mlePrice=origPrice-supplyPrice;
			 if(mlePrice>=minGross){//毛利额定价
				
				 var memDis=${ztMle.memPrice};
				 var commonPriceDis=${ztMle.commonPrice};
				
				 var commonPrice=origPrice-((mlePrice*commonPriceDis)/100).toFixed(2);
				 var mem=origPrice-((mlePrice*memDis)/100).toFixed(2);

				 $("#commonPrice").val(commonPrice);//普通用户价钱
				 //memPrice
				 $("#discountPrice").val(mem);//会员价
				 var commonOnePriceDis=${ztMle.commonOnePriceDis};
				 $("#discountOnePrice").val((mlePrice*commonOnePriceDis/100).toFixed(2));//会员价返佣
				
				 $("input[name='commonOnePrice']").val((commonOnePriceDis*mlePrice/100).toFixed(2));//普通/会员分佣
		/*
				 var copperPriceDis=memDis+${ztMle.copperPriceDis};
				 var copperPrice=origPrice-(copperPriceDis*mlePrice/100).toFixed(2);//铜牌价钱
				 $("input[name='copperPrice']").val(copperPrice);
				  
				 var silverPriceDis=memDis+${ztMle.silverPriceDis};
				 var silverPrice=origPrice-(silverPriceDis*mlePrice/100).toFixed(2);//银牌价钱
				 $("input[name='silverPrice']").val(silverPrice);
				  
				 var goldPriceDis=memDis+${ztMle.goldPriceDis};
				 var goldPrice=origPrice-(goldPriceDis*mlePrice/100).toFixed(2);//金牌价钱
				 $("input[name='goldPrice']").val(goldPrice);
				  
				 var copperOnePriceDis=${ztMle.copperOnePriceDis};
				 $("input[name='copperOnePrice']").val((copperOnePriceDis*mlePrice/100).toFixed(2));
				 var copperTwoPriceDis=${ztMle.copperTwoPriceDis};
				 $("input[name='copperTwoPrice']").val((copperTwoPriceDis*mlePrice/100).toFixed(2));
				 var tcopperOnePriceDis=${ztMle.tcopperOnePriceDis};
				 $("input[name='tcopperOnePrice']").val((tcopperOnePriceDis*mlePrice/100).toFixed(2));
				 var tcopperTwoPriceDis=${ztMle.tcopperTwoPriceDis};
				 $("input[name='tcopperTwoPrice']").val((tcopperTwoPriceDis*mlePrice/100).toFixed(2));
				 var ycopperOnePriceDis=${ztMle.ycopperOnePriceDis};
				 $("input[name='ycopperOnePrice']").val((ycopperOnePriceDis*mlePrice/100).toFixed(2));
				 var ycopperTwoPriceDis=${ztMle.ycopperTwoPriceDis};
				 $("input[name='ycopperTwoPrice']").val((ycopperTwoPriceDis*mlePrice/100).toFixed(2));
				 var jcopperOnePriceDis=${ztMle.jcopperOnePriceDis};
				 $("input[name='jcopperOnePrice']").val((jcopperOnePriceDis*mlePrice/100).toFixed(2));
				 var jcopperTwoPriceDis=${ztMle.jcopperTwoPriceDis};
				 $("input[name='jcopperTwoPrice']").val((jcopperTwoPriceDis*mlePrice/100).toFixed(2));
				 
				 var silverOnePriceDis=${ztMle.silverOnePriceDis};
				 $("input[name='silverOnePrice']").val((silverOnePriceDis*mlePrice/100).toFixed(2));
				 var silverTwoPriceDis=${ztMle.silverTwoPriceDis};
				 $("input[name='silverTwoPrice']").val((silverTwoPriceDis*mlePrice/100).toFixed(2));
				 var tsilverOnePriceDis=${ztMle.tsilverOnePriceDis};
				 $("input[name='tsilverOnePrice']").val((tsilverOnePriceDis*mlePrice/100).toFixed(2));
				 var tsilverTwoPriceDis=${ztMle.tsilverTwoPriceDis};
				 $("input[name='tsilverTwoPrice']").val((tsilverTwoPriceDis*mlePrice/100).toFixed(2));
				 var ysilverOnePriceDis=${ztMle.ysilverOnePriceDis};
				 $("input[name='ysilverOnePrice']").val((ysilverOnePriceDis*mlePrice/100).toFixed(2));
				 var ysilverTwoPriceDis=${ztMle.ysilverTwoPriceDis};
				 $("input[name='ysilverTwoPrice']").val((ysilverTwoPriceDis*mlePrice/100).toFixed(2));
				 var jsilverOnePriceDis=${ztMle.jsilverOnePriceDis};
				 $("input[name='jsilverOnePrice']").val((jsilverOnePriceDis*mlePrice/100).toFixed(2));
				 var jsilverTwoPriceDis=${ztMle.jsilverTwoPriceDis};
				 $("input[name='jsilverTwoPrice']").val((jsilverTwoPriceDis*mlePrice/100).toFixed(2));
				 
				 var goldOnePriceDis=${ztMle.goldOnePriceDis};
				 $("input[name='goldOnePrice']").val((goldOnePriceDis*mlePrice/100).toFixed(2));
				 var goldTwoPriceDis=${ztMle.goldTwoPriceDis};
				 $("input[name='goldTwoPrice']").val((goldTwoPriceDis*mlePrice/100).toFixed(2));
				 var tgoldOnePriceDis=${ztMle.tgoldOnePriceDis};
				 $("input[name='tgoldOnePrice']").val((tgoldOnePriceDis*mlePrice/100).toFixed(2));
				 var tgoldTwoPriceDis=${ztMle.tgoldTwoPriceDis};
				 $("input[name='tgoldTwoPrice']").val((tgoldTwoPriceDis*mlePrice/100).toFixed(2));
				 var ygoldOnePriceDis=${ztMle.ygoldOnePriceDis};
				 $("input[name='ygoldOnePrice']").val((ygoldOnePriceDis*mlePrice/100).toFixed(2));
				 var ygoldTwoPriceDis=${ztMle.ygoldTwoPriceDis};
				 $("input[name='ygoldTwoPrice']").val((ygoldTwoPriceDis*mlePrice/100).toFixed(2));
				 var jgoldOnePriceDis=${ztMle.jgoldOnePriceDis};
				 $("input[name='jgoldOnePrice']").val((jgoldOnePriceDis*mlePrice/100).toFixed(2));
				 var jgoldTwoPriceDis=${ztMle.jgoldTwoPriceDis};
				 $("input[name='jgoldTwoPrice']").val((jgoldTwoPriceDis*mlePrice/100).toFixed(2));
*/
			 }
			
		 }else{//折扣率定价       ztSk
				 var mem = 0;
				 var memDis = 0;
				 if (number2 < 40) {
					 memDis =${ztSk.memOne};
					 mem = ((origPrice * memDis) / 100).toFixed(2);
				 } else if (number2 >= 40 && number2 < 50) {
					 memDis =${ztSk.memTwo};
					 mem = ((origPrice * memDis) / 100).toFixed(2);
				 } else if (number2 >= 50 && number2 < 60) {
					 memDis =${ztSk.memThree};
					 mem = ((origPrice * memDis) / 100).toFixed(2);
				 } else if (number2 >= 60 && number2 < 70) {
					 memDis =${ztSk.memFour};
					 mem = ((origPrice * memDis) / 100).toFixed(2);
				 } else if (number2 >= 70 && number2 < 80) {
					 memDis =${ztSk.memFive};
					 mem = ((origPrice * memDis) / 100).toFixed(2);
				 } else if (number2 >= 80 && number2 < 90) {
					 memDis =${ztSk.memSix};
					 mem = ((origPrice * memDis) / 100).toFixed(2);
				 }
				 var commonPriceDis =${ztSk.commonPriceDis};

				 var commonPrice = ((origPrice * commonPriceDis) / 100).toFixed(2);

				 $("#commonPrice").val(commonPrice);//普通用户价钱

				 $("#discountPrice").val(mem);//会员价
				 var commonOnePriceDis =${ztSk.commonOnePriceDis};
				 $("#discountOnePrice").val((mem * commonOnePriceDis / 100).toFixed(2));//会员价返佣

				 $("input[name='commonOnePrice']").val((commonOnePriceDis * commonPrice / 100).toFixed(2));//普通/会员分佣
				 /*
			 var copperPriceDis=memDis-${ztSk.copperPriceDis};
			 var copperPrice=(copperPriceDis*origPrice/100).toFixed(2);//铜牌价钱
			 $("input[name='copperPrice']").val(copperPrice);
			  
			 var silverPriceDis=memDis-${ztSk.silverPriceDis};
			 var silverPrice=(silverPriceDis*origPrice/100).toFixed(2);//银牌价钱
			 $("input[name='silverPrice']").val(silverPrice);
			  
			 var goldPriceDis=memDis-${ztSk.goldPriceDis};
			 var goldPrice=(goldPriceDis*origPrice/100).toFixed(2);//金牌价钱
			 $("input[name='goldPrice']").val(goldPrice);
			  
			 var copperOnePriceDis=${ztSk.copperOnePriceDis};
			 $("input[name='copperOnePrice']").val((copperOnePriceDis*commonPrice/100).toFixed(2));
			 var copperTwoPriceDis=${ztSk.copperTwoPriceDis};
			 $("input[name='copperTwoPrice']").val((copperTwoPriceDis*commonPrice/100).toFixed(2));
			// var tcopperOnePriceDis=${ztSk.tcopperOnePriceDis};
			 $("input[name='tcopperOnePrice']").val((copperOnePriceDis*copperPrice/100).toFixed(2));
			// var tcopperTwoPriceDis=${ztSk.tcopperTwoPriceDis};
			 $("input[name='tcopperTwoPrice']").val((copperTwoPriceDis*copperPrice/100).toFixed(2));
			// var ycopperOnePriceDis=${ztSk.ycopperOnePriceDis};
			 $("input[name='ycopperOnePrice']").val((copperOnePriceDis*silverPrice/100).toFixed(2));
			// var ycopperTwoPriceDis=${ztSk.ycopperTwoPriceDis};
			 $("input[name='ycopperTwoPrice']").val((copperTwoPriceDis*silverPrice/100).toFixed(2));
			// var jcopperOnePriceDis=${ztSk.jcopperOnePriceDis};
			 $("input[name='jcopperOnePrice']").val((copperOnePriceDis*goldPrice/100).toFixed(2));
		//	 var jcopperTwoPriceDis=${ztSk.jcopperTwoPriceDis};
			 $("input[name='jcopperTwoPrice']").val((copperTwoPriceDis*goldPrice/100).toFixed(2));
			 
			 var silverOnePriceDis=${ztSk.silverOnePriceDis};
			 $("input[name='silverOnePrice']").val((silverOnePriceDis*commonPrice/100).toFixed(2));
			 var silverTwoPriceDis=${ztSk.silverTwoPriceDis};
			 $("input[name='silverTwoPrice']").val((silverTwoPriceDis*commonPrice/100).toFixed(2));
			// var tsilverOnePriceDis=${ztSk.tsilverOnePriceDis};
			 $("input[name='tsilverOnePrice']").val((silverOnePriceDis*copperPrice/100).toFixed(2));
		//	 var tsilverTwoPriceDis=${ztSk.tsilverTwoPriceDis};
			 $("input[name='tsilverTwoPrice']").val((silverTwoPriceDis*copperPrice/100).toFixed(2));
			// var ysilverOnePriceDis=${ztSk.ysilverOnePriceDis};
			 $("input[name='ysilverOnePrice']").val((silverOnePriceDis*silverPrice/100).toFixed(2));
		//	 var ysilverTwoPriceDis=${ztSk.ysilverTwoPriceDis};
			 $("input[name='ysilverTwoPrice']").val((silverTwoPriceDis*silverPrice/100).toFixed(2));
		//	 var jsilverOnePriceDis=${ztSk.jsilverOnePriceDis};
			 $("input[name='jsilverOnePrice']").val((silverOnePriceDis*goldPrice/100).toFixed(2));
		//	 var jsilverTwoPriceDis=${ztSk.jsilverTwoPriceDis};
			 $("input[name='jsilverTwoPrice']").val((silverTwoPriceDis*goldPrice/100).toFixed(2));
			 
			 var goldOnePriceDis=${ztSk.goldOnePriceDis};
			 $("input[name='goldOnePrice']").val((goldOnePriceDis*commonPrice/100).toFixed(2));
			 var goldTwoPriceDis=${ztSk.goldTwoPriceDis};
			 $("input[name='goldTwoPrice']").val((goldTwoPriceDis*commonPrice/100).toFixed(2));
		//	 var tgoldOnePriceDis=${ztSk.tgoldOnePriceDis};
			 $("input[name='tgoldOnePrice']").val((goldOnePriceDis*copperPrice/100).toFixed(2));
		//	 var tgoldTwoPriceDis=${ztSk.tgoldTwoPriceDis};
			 $("input[name='tgoldTwoPrice']").val((goldTwoPriceDis*copperPrice/100).toFixed(2));
		//	 var ygoldOnePriceDis=${ztSk.ygoldOnePriceDis};
			 $("input[name='ygoldOnePrice']").val((goldOnePriceDis*silverPrice/100).toFixed(2));
		//	 var ygoldTwoPriceDis=${ztSk.ygoldTwoPriceDis};
			 $("input[name='ygoldTwoPrice']").val((goldTwoPriceDis*silverPrice/100).toFixed(2));
		//	 var jgoldOnePriceDis=${ztSk.jgoldOnePriceDis};
			 $("input[name='jgoldOnePrice']").val((goldOnePriceDis*goldPrice/100).toFixed(2));
		//	 var jgoldTwoPriceDis=${ztSk.jgoldTwoPriceDis};
			 $("input[name='jgoldTwoPrice']").val((goldTwoPriceDis*goldPrice/100).toFixed(2));
			 */

		 }
		

	}); 
	//折扣
	/* $("select[name='discount']").change(function() {
		var origPrice = $("#commonPrice").val();
		var discount = $("#discount").val();
		
		if(origPrice != null && origPrice != undefined && origPrice !=''){	
			  if(discount != null && discount != undefined && discount !=''){
				  $("#discountPrice").val(((discount)*origPrice).toFixed(2));	
			  }
			}  

	}); */
	

});
$(document).ready(
		function() {
			var freightType=$("#freightType").val();
			if(freightType==0){
				$("#freight").hide();
				
			}else{
				$("#freight").show();
			}
			$("#freightType").change(function() {
				var s = $(this).val();
				
				
				if(s==0){//文章
					$("#freight").hide();
				}else{//商品
					$("#freight").show();
				}
			});
			
		});
		
		
		

		

	
function getGoodsType(brandid) {

	// ajax请求所有市级单位
	$.get("${ctx}/brand/getType", {
		brandid : brandid
	}, function(data) {
		
		$("#parentCode").val(data.type);
		$("#parentName").val(data.typeName);
		
	}, 'json');
}


	$("#inputForm").validate({
		submitHandler : function(form) {
			js.ajaxSubmitForm($(form), function(data) {
				js.showMessage(data.message);
				if (data.result == Global.TRUE) {
					js.closeCurrentTabPage(function(contentWindow) {
						contentWindow.page();
					});
				}
			}, "json");
		}
	});
	
	function treeselectCallback(id, act, index, layero){
		if (id == 'parent' && (act == 'ok' || act == 'clear')){
			// 创建并初始化下一个节点信息，如：排序号、默认值
			$.get('${ctx}/goodsType/createNextNode?parentCode='
					+$('#parentCode').val(), function(data){
				$('#treeSort').val(data.treeSort);
			});
		}
	}
function findtemplate(date) {
	$("#goodstemp option:checked").each(function(e) {
		if($(this).val()==6){
			$("#titleBuyQuantity").html("*提示:记得填写限定购买数量")
			$("#titleNewTalentType").html("*提示:记得选择新人特惠")
			$("#titleNewPrice").html("*提示:记得填写新人专属价")
			return false;
		} else {
			$("#titleBuyQuantity").html("")
			$("#titleNewTalentType").html("")
			$("#titleNewPrice").html("")
		};
	});

}
</script>


